﻿// Copyright © 2010 onwards, Andrew Whewell
// All rights reserved.
//
// Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
//    * Neither the name of the author nor the names of the program's contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VirtualRadar.Interface
{
    /// <summary>
    /// The interface for implementations of <see cref="IAircraftList"/> that can have aircraft created and added to the list
    /// by the program rather than from an external source like an instance of BaseStation.
    /// </summary>
    /// <remarks>
    /// This is used to hold aircraft lists that are generated by the program, such as the flight simulator aircraft
    /// list.
    /// </remarks>
    public interface ISimpleAircraftList : IAircraftList
    {
        /// <summary>
        /// Gets the object that should be used to lock the <see cref="Aircraft"/> list before it is modified.
        /// </summary>
        /// <remarks>
        /// If the list will not be accessed from multiple threads then this can be ignored. Bear in mind that if the list
        /// is given to the website or web server then it will be accessed from multiple threads by those.
        /// </remarks>
        object ListSyncLock { get; }

        /// <summary>
        /// Gets or sets the aircraft source - overrides the base version which is read-only.
        /// </summary>
        /// <remarks>
        /// Writes to this are not particularly thread-safe but it is anticipated that it will only be written once when
        /// the list is first created and then left alone. This value is sent to the web site but as at the time of writing
        /// it is unused, it's just there for diagnostic purposes.
        /// </remarks>
        new AircraftListSource Source { get; set; }

        /// <summary>
        /// Gets the list of aircraft that will be exposed by the standard aircraft list methods.
        /// </summary>
        /// <remarks>
        /// The list will automatically make clones of these aircraft objects when it presents them to the outside world. It will
        /// lock each aircraft when making the clone using the <see cref="IAircraft"/> itself as the sync lock and it will lock the
        /// list using the <see cref="ListSyncLock"/> property.
        /// </remarks>
        List<IAircraft> Aircraft { get; }
    }
}
